<?php
/* @var $this CampaignController */
/* @var $model Campaign */

$this->breadcrumbs=array(
	'Campaigns'=>array('index'),
	'Manage',
);
Yii::app()->clientScript->registerScript('search', "
$('.search-button').click(function(){
	$('.search-form').toggle();
	return false;
});
$('.search-form form').submit(function(){
	$('#campaign-grid').yiiGridView('update', {
		data: $(this).serialize()
	});
	return false;
});
");
?>

<h1><?php Yii::t('base','Manage Campaigns')?></h1>
<?php echo Yii::t('base','<p>
You may optionally enter a comparison operator (<b>&lt;</b>, <b>&lt;=</b>, <b>&gt;</b>, <b>&gt;=</b>, <b>&lt;&gt;</b>
or <b>=</b>) at the beginning of each of your search values to specify how the comparison should be done.
</p>')?>


<?php echo CHtml::link('Advanced Search','#',array('class'=>'search-button')); ?>
<div class="search-form" style="display:none">
<?php $this->renderPartial('_search',array(
	'model'=>$model,
)); ?>
</div><!-- search-form -->
<a class="btn btn-small create" title="<?php echo Yii::t('base','Create');echo Yii::t('base','Sales Campaign');?>" href="<?php echo Yii::app()->request->baseUrl; ?>/campaign/create?level=12"><?php echo Yii::t('base','Create');echo Yii::t('base','Sales Campaign');?></a>
<?php $this->widget('zii.widgets.grid.CGridView', array(
	'id'=>'campaign-grid',
	'dataProvider'=>$model->search(),
	'itemsCssClass'=>'responsive table table-striped table-bordered',
	'pager'=>array('class'=>'CLinkPager','hiddenPageCssClass'=>'','firstPageCssClass'=>'first paginate_button','firstPageLabel'=>'First','prevPageLabel' => 'Previous','nextPageLabel' => 'Next','lastPageLabel'=>'Last','htmlOptions'=>array('class'=>'dataTables_paginate paging_full_numbers"')),
	'pagerCssClass'=>'pagination pull-right',
	//'filter'=>$model,
	'columns'=>array(
array('name'=>'zy_campaign_id','headerHtmlOptions'=>array('style'=>'width:7%')),
array('name'=>'campaign_name','headerHtmlOptions'=>array('style'=>'width:14%')),
array('name'=>'zy_campaign_script','headerHtmlOptions'=>array('style'=>'width:14%')),
array('name'=>'sales_people','headerHtmlOptions'=>array('style'=>'width:14%'),'value'=>'Campaign::model()->getSalesPeopleName($data->sales_people)'),
array('name'=>'zy_potentiel_customers_list_id','headerHtmlOptions'=>array('style'=>'width:14%'),'value'=>'PotentialCustomersList::model()->getListName($data->zy_potentiel_customers_list_id)'),
array('name'=>'zy_campaign_status','headerHtmlOptions'=>array('style'=>'width:14%'),'value'=>'Campaign::model()->getcampaignstatusName($data->zy_campaign_status)'),
//array('name'=>'opentime','headerHtmlOptions'=>array('style'=>'width:14%')),
//array('name'=>'closetime','headerHtmlOptions'=>array('style'=>'width:14%')),
		array(
			'class'=>'CButtonColumn',
			'header'=>Yii::t('base','Operate'),
			'viewButtonImageUrl'=>array('class'=>'gicon-edit'),
			'viewButtonOptions'=>array('class'=>'btn btn-small'),
			'updateButtonImageUrl'=>array('class'=>'gicon-edit'),
			'updateButtonOptions'=>array('class'=>'btn btn-small'),
			'deleteButtonImageUrl'=>array('class'=>'gicon-edit'),
			'deleteButtonOptions'=>array('class'=>'btn btn-inverse btn-small'),
			'template'=>'{view}{update}{delete}{viewCallHistory}',
				'buttons'=>array(
				'viewCallHistory'=>array(
				'label'=>yii::t('base','viewCallHistory'),
				'url'=>'Yii::app()->createUrl("status/admin",array("campaign_id"=>$data->zy_campaign_id))',
				'options'=>array('class'=>'btn btn-small'),
				),			
			),
		),
	),
)); ?>
